/**
 * description:ArrayUtils
 * date: 2022/04/15/18:54:00
 * author: xinyu
 * version: 1.0
 **/
import {BaseUtils} from "./BaseUtils"
interface InterArrayUtils {
    StringToNum(arr: string[]): number[];//把数组里的字符串全部转换成number返回一个全是number的数组
    SortCompareUp(arr: number[]): number[];//数组升序排列,返回一个已经升序排列的数组
    SortCompareDown(arr:number[]):number[];//数组降序排列，返回一个已经降序排列的数组
}

class ArrayUtils extends BaseUtils implements  InterArrayUtils {
    public readonly Array_;

    constructor(Array_?) {
        super()
        this.Array_ = Array_;
    }

    public StringToNum(arr: string[]): number[] {
        let NumArr: number[] = []
        for (let str in arr) {
            NumArr.push(parseInt(arr[str]))
        }
        return NumArr
    }

    public SortCompareUp(arr: number[]): number[] {
        return arr.sort(this.Compare)
    }
    public SortCompareDown(arr: number[]): number[] {
        return arr.sort(this.Compare).reverse()
    }

}

export {ArrayUtils}